<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        .parent {
            background: cyan;
            /* display: flex;
            flex-direction: column;
            flex-wrap: wrap; */
            display: flex;
            writing-mode: vertical-lr;
            flex-wrap: wrap;
            align-content: flex-start;
          
            height: 100vh;
        }
        .child {
            height: 30%;
            background: orange;
            width: 100px;
            writing-mode: horizontal-tb;
            margin-right: 20px;
            margin-bottom: 20px;
            /* flex-shrink: 0; */
        }
    </style>
</head>
<body>
    <div style="display: flex;">
        <div style="display: flex; ;">
            <div>A</div>
            <div class="parent">
                <div class="child">1</div>
                <div class="child">2</div>
                <div class="child">3</div>
                <div class="child">4</div>
                <div class="child">5</div>
            </div>
        </div>

        <div style="display: flex;">
            <div>B</div>
            <div class="parent">
                <div class="child">1</div>
                <div class="child">2</div>
                <div class="child">3</div>
                <div class="child">4</div>
                <div class="child">5</div>
            </div>
        </div>

    <div style="display: flex;">
        <div style="background: #1890ff;">
            1
        </div>

        <div style="background: orchid;">
        2
        </div>
    </div>

</div>
</body>
</html>